<?php

namespace App\Http\Requests;

use App\Http\Requests\Base;

class AdminLogin extends Base
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'account'        => [
                'required',
                'alpha_num',
                'between:4,12',
            ],

            'login_password' => [
                'required',
                'alpha_num',
                'between:5,12',
            ],

            'captcha'        => [
                'required',
                'captcha',
            ],
        ];
    }

    public function messages()
    {
        return [
            'account.required'              => '请填写账号！',
            'account.alpha_num'             => '请填写正确账号！',
            'account.digits_between'        => '请填写正确账号！',

            'login_password.required'       => '请填写登录密码！',
            'login_password.alpha_num'      => '请填写正确登录密码！',
            'login_password.digits_between' => '请填写正确登录密码！',

            'captcha.required'              => '请填写验证码！',
            'captcha.captcha'               => '请填写正确的验证码！',
        ];
    }

}
